package na.learn.java.threads;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;

public class Test {

	private static final float Default_Young_Ratio = 0.5f;

	// Size ratio of YoungQueue / CacheSize.
	private float youngRatio;
	
	
	public Test(){
		youngRatio = 1.0f;
	}

	public static void main(String[] args) {
		
		Test test = new Test();
		test.handleRatio(0.3456f);
		test.handleRatio(7.3456f);
		test.handleRatio(0.7456f);
		test.handleRatio(0.0456f);
		test.handleRatio(1.0f);
		test.handleRatio(0.9f);
		
		

	}

	public void handleRatio(float youngRatio) {
		{

			youngRatio = new Float(((int) (youngRatio * 10)) / 10f)
					.floatValue();

			if (youngRatio < 0.5f || youngRatio > 1.0f)
				this.youngRatio = Default_Young_Ratio;
			else
				this.youngRatio = youngRatio;

			System.out.println(this.youngRatio);

		}

	}

	public float getYoungRatio() {
		return youngRatio;
	}

	public void setYoungRatio(float youngRatio) {
		this.youngRatio = youngRatio;
	}
	
	

}
